#include "windows.h"
#include "mmsystem.h"

#include <process.h>
#include "SimpThread.h"
#include "BaseCode.h"


//////////////////////////////////////////////////////////////////////
BOOL		CSimpThread::s_fTerminated	= FALSE;

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSimpThread::CSimpThread()
{
}

CSimpThread::~CSimpThread()
{

}

//////////////////////////////////////////////////////////////////////
BOOL CSimpThread::Create(SIMPTHREAD_FUNC func, void* pParam)
{
	DWORD dwID;
	HANDLE hThread	= (HANDLE)_beginthreadex (	NULL,					// default security
											0,							// default stack size
											func,						// pointer to thread routine
											pParam,						// argument for thread
											0,							// start it right away if 0, else suspend
											(unsigned *)&dwID);
	if (!hThread)
		return FALSE;

	SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST);
	
	::CloseHandle(hThread);

	return TRUE;
}
